package com.adderis.soft.domain.model;

import static javax.persistence.GenerationType.AUTO;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * @author Reda
 * @version 1.0
 * @created 20-avr.-2014 22:47:44
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "cloudpoint", catalog = "adderis")
public class Cloudpoint implements java.io.Serializable {

	private int cloudPointId;
	private Integer cloudPoint;
	private Date createtimestamp;
	private String statutcode;
	private Date updatetimesstamp;
	private Date deletiontimesstamp;
	private Set<Methode> methodes = new HashSet<Methode>(0);
	private Set<NomCommercial> nomCommercials = new HashSet<NomCommercial>(0);

	public Cloudpoint() {
	}

	public Cloudpoint(int cloudPointId) {
		this.cloudPointId = cloudPointId;
	}

	public Cloudpoint(Integer cloudPoint) {
		this.cloudPoint = cloudPoint;
	}

	public Cloudpoint(Integer cloudPoint, Set<Methode> methodes) {

		this.cloudPoint = cloudPoint;
		this.methodes = methodes;
	}

	@Column(name = "createdatetime")
	@Temporal(TemporalType.TIMESTAMP)
	public Date getCreatetimestamp() {
		return createtimestamp;
	}

	public void setCreatetimestamp(Date createtimestamp) {
		this.createtimestamp = createtimestamp;
	}

	@Column(name = "statutcode", length = 10)
	public String getStatutcode() {
		return statutcode;
	}

	public void setStatutcode(String statutcode) {
		this.statutcode = statutcode;
	}

	@Column(name = "updatedatetime")
	@Temporal(TemporalType.TIMESTAMP)
	public Date getUpdatetimesstamp() {
		return updatetimesstamp;
	}

	public void setUpdatetimesstamp(Date updatetimesstamp) {
		this.updatetimesstamp = updatetimesstamp;
	}

	@Column(name = "deletiondatetime")
	@Temporal(TemporalType.TIMESTAMP)
	public Date getDeletiontimesstamp() {
		return deletiontimesstamp;
	}

	public void setDeletiontimesstamp(Date deletiontimesstamp) {
		this.deletiontimesstamp = deletiontimesstamp;
	}

	@Id
	@GeneratedValue(strategy = AUTO)
	@Column(name = "cloudPointID", unique = true, nullable = false)
	public int getCloudPointId() {
		return this.cloudPointId;
	}

	public void setCloudPointId(int cloudPointId) {
		this.cloudPointId = cloudPointId;
	}

	@Column(name = "CloudPoint")
	public Integer getCloudPoint() {
		return this.cloudPoint;
	}

	public void setCloudPoint(Integer cloudPoint) {
		this.cloudPoint = cloudPoint;
	}

	@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
	@JoinTable(name = "joincloudpointtomethode", catalog = "adderis", joinColumns = { @JoinColumn(name = "cloudPointID", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "methodeID", nullable = false, updatable = false) })
	public Set<Methode> getMethodes() {
		return methodes;
	}

	public void setMethodes(Set<Methode> methodes) {
		this.methodes = methodes;
	}

	@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
	@JoinTable(name = "joinnomcommercialtocloudpoint", catalog = "adderis", joinColumns = { @JoinColumn(name = "cloudPointID", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "nomCommercialID", nullable = false, updatable = false) })
	public Set<NomCommercial> getNomCommercials() {
		return nomCommercials;
	}

	public void setNomCommercials(Set<NomCommercial> nomCommercials) {
		this.nomCommercials = nomCommercials;
	}

}
